import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Creat with IntelliJ IDEA
 * Description
 * User: mamba24
 * Date: 2022-11-10
 * Time: 17:04
 * To BE A Better Person-2020-3-2
 */
@WebServlet("/redirect")
public class Redirection extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //设置状态码
//        int sc= 200;
//        resp.setStatus(sc);
        //重定向
        //1.设置状态码为3xx
        resp.setStatus(302);
        resp.setHeader("Location","https://www.bilibili.com");
    }
}
